package libra.controller;

import java.util.Map;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Sentinel整合Gateway - Flow流控测试Controller
 */
@RestController
@RequestMapping("flow")
public class FlowController {
	String from = getClass().getSimpleName();
	
	
	/************************** 流控.阈值类型测试 ******************************/
	/**
	 * 测试[阈值类型(QPS + 无BurstSize)]
	 * 	流控方式：快速失败(默认)
	 */
	@RequestMapping("testQpsWithoutBurstSize")
	public Object testQpsWithoutBurstSize() {
		return Map.of("from", from, "method", "testQpsWithoutBurstSize");
	}
	
	/**
	 * 测试[阈值类型(QPS + 有BurstSize)]
	 * 	流控方式：快速失败(默认)
	 */
	@RequestMapping("testQpsWithBurstSize")
	public Object testQpsWithBurstSize() {
		return Map.of("from", from, "method", "testQpsWithBurstSize");
	}
	
	/**
	 * 测试[阈值类型(线程数)]
	 */
	@RequestMapping("testThread")
	public Object testThread() {
		return Map.of("from", from, "method", "testThread");
	}
	
}
